package com.gsd.es.test;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;
import org.elasticsearch.cluster.metadata.AliasMetadata;

import java.util.List;
import java.util.Map;

public class ESTest_Index_Search {
    public static void main(String[] args) throws Exception{

        RestHighLevelClient esClient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );


        //查询索引
        GetIndexRequest request = new GetIndexRequest("javacreate");
        GetIndexResponse getIndexResponse =
                esClient.indices().get(request, RequestOptions.DEFAULT);

        //响应状态
        System.out.println("索引操作："+getIndexResponse.getAliases());
        System.out.println("索引操作："+getIndexResponse.getMappings());
        System.out.println("索引操作："+getIndexResponse.getSettings());

        esClient.close();

    }
}
